package com.sprite.support.wechat.utils.model;

public class AccessToken {

	private String appId;
	private String accessToken;
	private long expiresIn;
	private long refreshTime;
	
	public AccessToken(String appId) {
		this.appId = appId;
	}
	
	public String getAppId() {
		return appId;
	}

	public String getAccessToken() {
		return accessToken;
	}
	
	public long getExpiresIn() {
		return expiresIn;
	}
	
	public boolean isExpired() {
		return System.currentTimeMillis() - refreshTime + 1000 > expiresIn;
	}
	
	public void refresh(String accessToken, long expiresIn) {
		refreshTime = System.currentTimeMillis();
		this.accessToken = accessToken;
		this.expiresIn = expiresIn;
	}
}
